﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Interfaces;
using System.ComponentModel.Composition;
using System.Windows;
using System.Windows.Controls;
using Helpers;
using System.IO;
using System.Windows.Input;

namespace xLibris
{
    [Export(typeof(MainWindowViewModel))]
    public class MainWindowViewModel : NotifyPropertyChangedBase
    {
        MainWindow mainWindow = null;

        [Import(typeof(MenuViewModel))]
        MenuViewModel menu;

        public MainWindowViewModel()
        {
        }

        UserControl _menuView;
        public UserControl MenuView
        {
            get { return _menuView; }
            set
            {
                _menuView = value;
                NotifyPropertyChanged("MenuView");
            }
        }

        public UserControl AppView
        {
            get { return menu.AppView; }
            set { }
        }

        public Window View()
        {
            mainWindow = new MainWindow();
            mainWindow.DataContext = this;
            menu.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(menu_PropertyChanged);
            MenuView = menu.View();
            AppView = null;
            return mainWindow;
        }

        void menu_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            if (e.PropertyName == "AppView")
            {
                NotifyPropertyChanged("AppView");
            }
        }
    }
}
